<form nz-form [formGroup]="form">
  
    <nz-form-item
      *ngFor="let item of items;"
      [ngSwitch]="item.type"
      nz-col
      [nzSpan]="(24/cols)*(item.colSpan||1)"
      [ngClass]="setClass(item)">
      <div nz-row>
      <nz-form-label [nzRequired]="item.required ? true : false">{{ item.label }}</nz-form-label>
      <nz-form-control [nzErrorTip]="setErrorTip(item)">
        <ng-container *ngSwitchCase="'custom'">
          <ng-container *ngIf="item.render && formRefs[item.render]" [ngTemplateOutlet]="formRefs[item.render].templateRef"></ng-container>
        </ng-container>
        <ng-container *ngSwitchCase="'text'">
          <input
            [id]="item.name"
            type="text"
            nz-input
            [formControlName]="item.name"
            [placeholder]="item.placeholder||''"
            autocomplete="off"
          />
        </ng-container>
        <ng-container *ngSwitchCase="'password'">
          <input
            [id]="item.name"
            type="password"
            nz-input
            [formControlName]="item.name"
            [placeholder]="item.placeholder||''"
            autocomplete="off"
          />
        </ng-container>
        <ng-container *ngSwitchCase="'textarea'">
          <textarea
            [id]="item.name"
            rows="5"
            nz-input
            [formControlName]="item.name"
            [placeholder]="item.placeholder||''"
          ></textarea>
        </ng-container>
        <ng-container *ngSwitchCase="'select'">
          <nz-select
            [id]="item.name"
            [formControlName]="item.name"
            [nzPlaceHolder]="item.placeholder||''"
          >
            <nz-option *ngIf="item.showAll" nzValue="" nzLabel="全部"></nz-option>
            <nz-option
              *ngFor="let option of item.data;"
              [nzValue]="option.value"
              [nzLabel]="option.label"
            ></nz-option>
          </nz-select>
        </ng-container>
        <ng-container *ngSwitchCase="'date'">
          <nz-date-picker
            [formControlName]="item.name"
            [nzPlaceHolder]="item.placeholder || ''"
          ></nz-date-picker>
        </ng-container>
        <ng-container *ngSwitchCase="'datetime'">
          <nz-date-picker
            [formControlName]="item.name"
            [nzPlaceHolder]="item.placeholder || ''"
            [nzShowTime]="true"
          ></nz-date-picker>
        </ng-container>
        <ng-container *ngSwitchCase="'radio'">
          <nz-radio-group
            [id]="item.name"
            [formControlName]="item.name"
          >
            <label
              *ngFor="let option of item.data;"
              nz-radio
              [nzValue]="option.value"
            >{{ option.label }}</label>
          </nz-radio-group>
        </ng-container>
        <ng-container *ngSwitchCase="'checkbox'">
          <yby-checkbox-list
            [data]="item.data"
            [formControlName]="item.name"
            [mode]="CheckMode.list"
          ></yby-checkbox-list>
        </ng-container>
      </nz-form-control>
      </div>
    </nz-form-item>
  
</form>